<?php
/**
 * Created by PhpStorm.
 * User: Acer
 * Date: 2022/7/28
 * Time: 0:19
 */

namespace app\wx\controller;
use app\core\MyController;
use app\wx\service\GzhSendMsgService;
use think\Log;

class GzhMsg extends MyController
{
    protected $noNeedAction = []; // 不需要校验控制器，通道
    // 操作前置
    protected $beforeActionList = ['my_initialize'];

    // 操作前置方法
    public function my_initialize()
    {

    }
    // 获取公众号关注消息
    public function get_gzh_msg(){
        $GzhSendMsgService =new GzhSendMsgService();
        $res= $GzhSendMsgService->s_get_msg();
        _action_result(200,$res,'操作成功！');
    }

    // 修改公众号消息
    public function modify_gzh_msg(){
        $data = input();
        if(empty($data['g_id']) || empty($data['content'])) json_err(-201);
        $GzhSendMsgService =new GzhSendMsgService();
        $GzhSendMsgService->s_modify_gzh_msg($data);
        _action_result(200,[],'操作成功！');
    }

    // 删除消息
    public function del_gzh_msg(){
        $data = input();
        if(empty($data['g_id'])) json_err(-201);
        $GzhSendMsgService =new GzhSendMsgService();
        $GzhSendMsgService->s_del_gzh_msg($data['g_id']);
        _action_result(200,[],'操作成功！');
    }
    // 新增消息
    public function add_gzh_msg(){
        $data = input();
        if(empty($data['content'])) json_err(-201);
        $GzhSendMsgService =new GzhSendMsgService();
        $GzhSendMsgService->s_add_gzh_msg($data);
        _action_result(200,[],'操作成功！');
    }
}